
			
            <div>
             <ul class="breadcrumb">
          	<li><a href="<?php echo HOME; ?>"><i class="fa fa-home"></i> Home</a></li>
            <li><a href="<?php echo HOME ?>user/upload">Upload</a></li>
             <li><a href="<?php echo url(); ?>">Cập Nhật Truyện</a></li>
          </ul>

           
            <div class="user_profile">
				
				<div class="row" >
					<div class="col-md-12 ">
						<div id="contentIndex" class="col-md-12">
				
										
										<div role="dialog" id="modalAlertBox" class="modal fade" style="display: none;">
											<div class="modal-dialog modal-wide">
												<div class="modal-content">
													<div class="modal-header">
														<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
														<h4 class="modal-title"></h4>
													</div>
											        <div class="modal-body">
														
														<div style="clear:both"></div>
											        </div>
												</div><!-- /.modal-content -->
											</div>
										</div>
										
										<div id="wrapLoadMoreItems">
											<div class="normalLoadBtn" id="loadMoreItems"><img width="20" alt="loading" src="public/images/loading.gif"> Loading </div><br>
										</div>
										<div class="formLoading"></div>
										
									
									    
									    <div class="generalError" style="display: none;"></div>
									    <form  class="userPostForm" role="form" method="post" >
											
					
										  <table class="table table-bordered table-striped">

              <tbody>
                
                
                   <tr >
                  <td>Chọn Truyện</td>
                <td>
  
                
    <input type="hidden" name="optionvalue" id="truyen_id" class="input-xlarge" data-placeholder="Nhập Tên Truyện ..."   /> 
<script>
	$(document).ready(function(){ 
	$('#truyen_id').select2({ 
		width:400,
		minimumInputLength: 3,
			ajax: { 
			url: "index.php?module=user&act=ajax&feed_truyen", 
			dataType: 'json', 
					data: function (term, page){ 
						return {q: term }; 
						}, 
						results: function (data, page) {
							return { results: data }; 
						}
			}
	
	}); 
	
	
	
	
	}); 
	
			  $("#truyen_id").on("change", function(e) {   
						//Feed chuong
						
					var values='tid='+e.val;
					$.ajax({
							 url: "index.php?module=user&act=ajax&feed_truyen3",
							 type: "get",
							 data:values,
							success: function(data){
								var  data = JSON.parse(data);
					 $('#truyen_tinhtrang').val(data.tinhtrang),
					 $('#truyen_chuongmoinhat').val(data.chuongmoinhat),
					 $('#truyen_pick').val(data.pick),
					 $('#truyen_duyet').val(data.trangthai),
					 $('#truyen_tukhoa').val(data.tags),
					 $('#truyen_glwebsite').val(data.getlink_type),
	    			 $('#truyen_glurl').val(data.getlink_source), 
					$('#truyen_glauto').val(data.getlink_auto), 
					$('#truyen_glmanual').val(data.getlink_manual), 
					$('#truyen_gllast').val(data.getlink_last),
					 $('#truyen_glstart').val(data.getlink_start),
					 $('#truyen_glorder').val(data.getlink_order),
					 $('#truyen_glpage').val(data.getlink_page)
							} 
						 });
       
        })
		
		
		

	

</script>
        
                                  						       					

        
                
                
                </td>
                </tr>
                
                  <tr >
                  <td>Chương Mới Nhất</td>
                 <td><input type="text" name="truyen_chuongmoinhat" id="truyen_chuongmoinhat" class="form-control" required /></td>
       	  		</tr>
                 
                
                   <tr >
                  <td>Từ Khóa</td>
                 <td><input type="text" name="truyen_tukhoa" id="truyen_tukhoa" class="form-control" required /></td>
       	  		</tr>
                
                  <tr >
                  <td>Tình Trạng </td>
                <td>
                <select id="truyen_tinhtrang" class="form-control">
                	<option value="">Chọn Tình Trạng Truyện</option>
                    <option value="1">Hoàn Thành</option>
                    <option value="2">Đang Cập Nhật</option>
                    <option value="3">Tạm Ngưng</option>
                </select>
                </td>
                </tr>
                     
                <tr >
                  <td>Pick</td>
                 <td><input type="text" name="truyen_pick" id="truyen_pick" class="form-control" required /></td>
       	  		<tr >
                       
                  <tr >
                  <td>Duyệt</td>
                 <td><input type="text" name="truyen_duyet" id="truyen_duyet" class="form-control" required />
               
                 </td>
           
                       <tr > 
                  <td>GL Website</td>
                 <td> 
                  <select name="truyen_glwebsite" id="truyen_glwebsite" class="form-control">
                	<option value="">Chọn Website</option>
                    <option value="1">SStruyen.com</option>
                    <option value="2">Webtruyen.com</option>
                    
                </select>
                 </td>
                </tr>
                    <tr > 
                  <td>GL Url</td>
                 <td> <input type="text" name="truyen_glurl" id="truyen_glurl" class="form-control" required /></td>
                </tr>
                <tr>
                <td>GL Auto</td>
                 <td> <input type="text" name="truyen_glauto" id="truyen_glauto" class="form-control" required /></td>
                </tr>
                  <tr>
                <td>GL Manual</td>
                 <td> <input type="text" name="truyen_glmanual" id="truyen_glmanual" class="form-control" required /></td>
                </tr>
                   <tr>
                <td>GL Last</td>
                 <td> <input type="text" name="truyen_gllast" id="truyen_gllast" class="form-control" required /></td>
                </tr>
             
                 <tr>
                <td>GL Start</td>
                 <td> <input type="text" name="truyen_glstart" id="truyen_glstart" class="form-control" required /></td>
                </tr>
                     <tr>
                <td>GL Order</td>
                 <td> <input type="text" name="truyen_glorder" id="truyen_glorder" class="form-control" required /></td>
                </tr>
                      <tr>
                <td>GL Page</td>
                 <td> <input type="text" name="truyen_glpage" id="truyen_glpage" class="form-control" required /></td>
                </tr>
                        <tr >
                  <td></td>
                 <td> 
				<input  class="btn btn-primary" type="button" value="Truyện Update" name="truyen_update" id="truyen_update" /> </td>
                </tr>
				
				 </tr>
                             </tbody>
            </table>

											
										</form>
				
						</div><!-- end #contentIndex -->
					</div>
					
					
				</div> <!-- End of row -->
			</div><!-- end wrap_1024 -->
	
		
<!-- end #wrapMain -->		
	
	  <script>
$('#truyen_update').click(function(e){
		    
	    	e.preventDefault();
	    	if($('#truyen_id').val()==''){alert('Xin vui lòng chọn truyện  !')
			return false;
			};
			
		
			//$(".alert").remove();
	  		$('.userPostForm').css('opacity', '0.3');
			$('.formLoading')
			.css('width', $('.userPostForm').width())
			.css('height', $('.userPostForm').height())
			.css('opacity', '1')
			.css('z-index','9999').css('display', 'block');
			$('#wrapLoadMoreItems').css('display', 'block').center();
	    	$.ajax({
	    		url : "index.php",
	    		type : 'POST',
				cache:false,
	    	
				//exit();
	    		data : {
					module: 'user',
					act : 'ajax',
					truyen_update: 1,
					truyen: $('#truyen_id').val(),
					tinhtrang: $('#truyen_tinhtrang').val(),
					pick: $('#truyen_pick').val(),
					trangthai: $('#truyen_duyet').val(),
					tags: $('#truyen_tukhoa').val(),
					getlink_type: $('#truyen_glwebsite').val(),
	    			getlink_source: $('#truyen_glurl').val(), 
					getlink_auto: $('#truyen_glauto').val(), 
					getlink_manual: $('#truyen_glmanual').val(), 
					getlink_last: $('#truyen_gllast').val(),
					getlink_start: $('#truyen_glstart').val(),
					getlink_order: $('#truyen_glorder').val(),
					getlink_page: $('#truyen_glpage').val()
	    			
	    		},
	    		
	    		success : function(data){
					$("#chuong_unblock").attr('checked', false); 
	    			$('.formLoading').css('display', 'none');
	    			$('#wrapLoadMoreItems').css('display', 'none');
	    			$('.userPostForm').css('opacity', '1');
					
	    			if(data)
					{ 			
								
								newData = $.parseJSON(data);
								if(newData.errors){
									var nerrors='';
									$.each(newData.errors, function(e, error){
										nerrors+=error;
										
										
									});
									popupMessage('Thông báo lỗi ',[nerrors],'alert-danger');
								}else{
								
				    				popupMessage('Thành công', ["Cập Nhật Thông Tin Truyện Thành Công"], 'alert-success');
					    			$('#popup_message').prepend('<div class="loading" id="mainLoading"><div id="loadMoreItems" class="normalLoadBtn"><img width="20" src="public/images/loading.gif" alt="loading" /> Loading </div><div class="clr"></div></div>');
					    			$('#mainLoading').delay(1500).slideUp(function(){
										//window.location.href = 'http://localhost/khodo/user/upload/text';
						    		});
								}
					
	    			} // End data
	    		} // end success
	    	}) // end ajax
})
	 
	

</script>